package com.aspire.boc.mms.wmf.action;

import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.aspire.boc.mms.wmf.model.WmfOperateLog;
import com.aspire.boc.mms.wmf.service.OperateLogService;
import com.aspire.boc.mms.wmf.util.Page;

@Controller
public class OperLogAct {
	private static Log log = LogFactory.getLog(OperLogAct.class);
	@RequestMapping(value = "/operLog/index")
	public String index(HttpServletRequest request, HttpServletResponse response ,HttpSession session) {
		log.info(">>>>>>>> /operaLog/index");
		return "../views/wmf/operlog/index.jsp";
	}
	
	@RequestMapping(value = "/operLog/list") 
	public @ResponseBody HashMap<String, Object> list(
			@RequestParam(value = "start", required = true) int start,
			@RequestParam(value = "limit", required = true) int limit,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		log.info(">>>>>>>>  /operLog/list" + start + "--->" + limit);
		HashMap<String, Object> map = new HashMap<String, Object>();
		Page page = new Page(start,limit);
		List<WmfOperateLog> logs = operateLogService.queryOperateLogPage(page);
		long total = operateLogService.queryOperateLogCount();
		map.put("logs", logs);
		map.put("total", total);///继续分页
		return map;
	}

	@Autowired
	private OperateLogService operateLogService;
}
